package com.ys.enume.sys;

public class TsDictionaryForFieldEnum {
	// 字段类型
	public enum FieldFrontType {
		TEXT("文本输入框", "t_text"),
		TEXT_NUMBER("数值输入框", "t_decimal"),
		TEXT_AREA("文本区域", "t_textarea"),
		FILE("附件", "t_file"),
		IMG("图片", "t_file2"),
		DATE_YY("年份选择框", "t_year"),
		DATE_YYMM("年月选择框", "t_monthly"),
		DATE_YYMMDD("日期选择框", "t_date"),
		DATE_YYMMDDHHMMSS("日期时间选择框", "t_datetime"),
		SELECTOR_DROPDOWN("下拉框", "t_dropdown"),
		SELECTOR_DROPDOWN_EDIT("下拉框(可编辑)", "t_dropdownedit"),
		SELECTOR_MODAL("弹出框", "t_buttontext"),
		SELECTOR_MODAL_EDIT("弹出框(可编辑)", "t_buttontextedit"),
		SELECTOR_SWITCH("选择框(转换)", "t_checkbox"),
		RADIO("单选按钮", "t_radio"),
		LABEL("标题/注解", "t_lable"),
		CONDITION("钩选查询条件", "t_checkcondition"),
		OPE("操作", "t_ope"),
		SELF_DEFINE_TPL("自定义脚本", "t_self_define_tpl");
		public String name;
		public String value;

		private FieldFrontType(String name, String value) {
			this.name = name;
			this.value = value;
		}

		public static String getName(String value) {
			for (FieldFrontType e : FieldFrontType.values()) {
				if (e.value == value) {
					return e.name;
				}
			}

			return "";
		}
		
		public static boolean checkIn(String value) {
			if (value == null) {
				return false;
			} else {
				for (FieldFrontType e : FieldFrontType.values()) {
					if (value.equals(e.value)) {
						return true;
					}
				}
			}
			return false;
		}
	}
	
	// 前台是否查询
	public enum FieldFrontConditions {
		NO("否", 0), YES("是", 1);
		public String name;
		public Integer value;

		private FieldFrontConditions(String name, Integer value) {
			this.name = name;
			this.value = value;
		}
	}
	
	// 前台是否隐藏
	public enum FieldFrontHidden {
		NO("否", 0), YES("是", 1);
		public String name;
		public Integer value;

		private FieldFrontHidden(String name, Integer value) {
			this.name = name;
			this.value = value;
		}
	}
	
	// 前台是否固定
	public enum FieldFrontFixed {
		NO("无固定", 0), LEFT("左固定", 1), RIGHT("右固定", 2);
		public String name;
		public Integer value;

		private FieldFrontFixed(String name, Integer value) {
			this.name = name;
			this.value = value;
		}

		public static String getLayerFiexd(Integer value) {
			if (value == null || value == NO.value) {
				return null;
			} else if (value == LEFT.value) {
				return "left";
			} else if (value == RIGHT.value) {
				return "right";
			}
			return null;
		}
	}
	
	// 字段是否允许为空
	public enum FieldNull {
		NO("否", 0), YES("是", 1);
		public String name;
		public Integer value;

		private FieldNull(String name, Integer value) {
			this.name = name;
			this.value = value;
		}
	}
	
	// 字段显示控制
	public enum FieldFrontTop {
		SUB_SHOW("制单网格", 0),
		FORM_SHOW("表头显示", 1),
		FORM_HIDDEN("表头隐藏", 2),
		SUB_HIDDEN("制单隐藏", 3),
		BOTTOM_SHOW("底部显示", 5),
		BOTTOM_HIDDEN("底部隐藏", 6),
		GRID_HIDDEN("网格隐藏", 7),
		GRID_STATIC("静态网格", 8);
		public String name;
		public Integer value;

		private FieldFrontTop(String name, Integer value) {
			this.name = name;
			this.value = value;
		}
	}
	
	// 前台显示类型
	public enum FieldFrontTemplet {
		TEXT("文本", "t_text"),
		TEXT_AREA("文本区域", "t_textarea");
		public String name;
		public String value;

		private FieldFrontTemplet(String name, String value) {
			this.name = name;
			this.value = value;
		}
	}
	
	// 查询条件类型
	public enum FieldFrontConditionsType {
		SYSTEM("按系统设置", "t_system"),
		BOTHLIKE("左右模糊", "t_bothlike"),
		LEFTLIKE("左模糊", "t_leftlike"),
		RIGHTLIKE("右模糊", "t_rightlike"),
		BETWEEN("区间", "t_between"),
		IN("包含", "t_in"),
		EQUAL("相等", "t_equal"),
		UNEQUAL("不等", "t_unequal"),
		GREATER("大于", "t_greater"),
		SMALLER("小于", "t_smaller"),
		UNGREATER("不大于", "t_ungreater"),
		UNSMALLER("不小于", "t_unsmaller"),
		CHECKCONDITION("钩选查询条件", "t_checkcondition"),
		IGNORE("忽略组装的条件", "t_ignore"),
		HIDDEN("隐藏", "t_hidden");
		public String name;
		public String value;

		private FieldFrontConditionsType(String name, String value) {
			this.name = name;
			this.value = value;
		}
	}
	
	// 数据权限字段
	public enum FieldFrontLimit {
		NO("未设权限", "no"),
		OPERATE("运营公司权限", "OperateData"),
		USER("个人权限", "UserData"),
		DEPT("部门权限", "DeptData"),
		COMPANY("公司权限", "CompanyData");
		public String name;
		public String value;

		private FieldFrontLimit(String name, String value) {
			this.name = name;
			this.value = value;
		}
	}
	
	// 是否可编辑
	public enum FieldFrontEdit {
		NO("否", 0), YES("是", 1);
		public String name;
		public Integer value;

		private FieldFrontEdit(String name, Integer value) {
			this.name = name;
			this.value = value;
		}
	}
	
	// 是否排序
	public enum StatusSort {
		NO("否", 0), YES("是", 1);
		public String name;
		public Integer value;

		private StatusSort(String name, Integer value) {
			this.name = name;
			this.value = value;
		}
	}
	
	// 冻结窗格状态
	public enum Fixed {
		YES("冻结", 1), NO("不冻结", 0);
		public String name;
		public Integer value;

		private Fixed(String name, Integer value) {
			this.name = name;
			this.value = value;
		}
	}
}
